package com.ts_xiaoa.ts_android_library.widget.indicator;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;

/**
 * create by ts_xiaoA on 2020-08-28 20:40
 * email：443502578@qq.com
 * desc：viewpager 指示器
 */
public class ViewPagerIndicator extends ViewGroup {
    public ViewPagerIndicator(Context context) {
        super(context);
    }

    public ViewPagerIndicator(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public ViewPagerIndicator(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
        int measureHeight = getPaddingTop() + getPaddingBottom();
        int childWidthMeasureSpec = MeasureSpec.makeMeasureSpec(MeasureSpec.getSize(widthMeasureSpec), MeasureSpec.AT_MOST);

        View indicatorView = getChildAt(0);
        switch (indicatorView.getWidth()) {
            case MeasureSpec.AT_MOST:
            case MeasureSpec.UNSPECIFIED:

                break;
            case MeasureSpec.EXACTLY:
                break;

        }
    }

    @Override
    protected void onFinishInflate() {
        super.onFinishInflate();
        if (getChildCount() > 1) {
            throw new IllegalArgumentException("viewpager's indicator just only one,you can use a parent viewGroup contain them");
        }
    }

    @Override
    protected void onLayout(boolean changed, int l, int t, int r, int b) {
    }
}
